package cn.tannn.ops.message.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * webhook 签名类型
 *
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @version V1.0
 * @date 2024/8/23 上午10:55
 */
@AllArgsConstructor
@Getter
public enum WebHookSecretType {

    /**
     * 签名密钥
     */
    SIGNING_KEY(1, "签名密钥"),

    /**
     * 密码
     */
    PASSWORD(2,"密码");


    private final Integer type;
    private final String name;

    /**
     * 获取枚举实例
     */
    public static WebHookSecretType fromName(String name) {
        for (WebHookSecretType signType : WebHookSecretType.values()) {
            if (Objects.equals(name, signType.getName())) {
                return signType;
            }
        }
        throw new IllegalArgumentException();
    }
}
